<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>管理后台</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <!-- <link rel="stylesheet" title="default" href="{% static 'amis/public/resource/sdk_2.1.0/sdk.css' %}" />
    <link rel="stylesheet" href="{% static 'amis/public/resource/helper.css' %}" />
    <script src="{% static 'amis/public/resource/sdk_2.1.0/sdk.js' %}"></script>
    <script src="{% static 'amis/public/resource/vue@2' %}"></script>
​ -->
    <link
            rel="stylesheet"
            title="default"
            href="public/sdk.css"
    />
    <link rel="stylesheet" href="public/helper.css" />
    <link
            rel="stylesheet"
            href="public/iconfont.css"
    />
    <script src="public/sdk.js"></script>
    <script src="public/vue.js"></script>

<!--    <script src="https://unpkg.com/vue@2"></script>-->

    <script src="public/core.min.js"></script>
    <script src="public/md5.js"></script>
    <style>
    html,
    body,
    .app-wrapper {
        position: relative;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
    }

    .loginTitle {
        text-align: center;
    }

    .loginTitle p {
        margin: 10px auto;
        color: black;
        font-size: 25px;
    }
    </style>
</head>

<body>
<div id="root" class="app-wrapper"></div>
<script>
    (function() {
        let amis = amisRequire('amis/embed');

        // 清理掉vue控制台无效打印
        Vue.config.productionTip = false;
        Vue.config.devtools = false

        // 全局后端url
        // const serverUrl = 'http://192.168.1.127:8080';

        // 清理token
        localStorage.removeItem("user_code");

        const app = {
            type: 'page',
            title: "",
            style: {
                "backgroundImage": "linear-gradient(180deg, #86a4e9, transparent)"
            },
            cssVars: {
                "--Form-input-onFocused-borderColor": "#e8e9eb",
                "--Form-input-onHover-borderColor": "#e8e9eb",
            },
            body: {
                "type": "grid-2d",
                "cols": 12,
                "grids": [{
                        x: 5,
                        y: 5,
                        h: 1,
                        w: 4,
                        width: 200,
                        type: 'form',
                        mode: 'horizontal',
                        title: "",
                        api: {
                            url: "/login/simpleLogin",
                            method: "post",
                            adaptor: function(payload, response, api) {
                                if (payload.status == 0) {
                                    payload.msg = "登陆成功"
                                }
                                localStorage.setItem("user_code",payload.data.user_code);
                                return payload;
                            }
                        },
                        panelClassName: "p-r p-l p-b-md",
                        redirect: "/index.html",
                        body: [{
                                "type": "tpl",
                                "tpl": "<div class='loginTitle'><p>管理后台</p></div>"
                            },
                            {
                                type: "input-text",
                                label: false,
                                name: "userCode",
                                size: "full",
                                placeholder: "登陆名",
                                addOn: {
                                    "label": "",
                                    "type": "text",
                                    "position": "left",
                                    "icon": "fa fa-user"
                                },
                            },
                            {
                                type: "input-password",
                                label: false,
                                name: "userPassword",
                                size: "full",
                                placeholder: "密码",
                                addOn: {
                                    "label": "",
                                    "type": "text",
                                    "position": "left",
                                    "icon": "fa fa-lock"
                                },
                            },
                            {
                                type: "checkbox",
                                label: false,
                                name: "record",
                                option: "记住密码"
                            },
                            {
                                type: "control",
                                label: false,
                                body: {
                                    "type": "button",
                                    "level": "primary",
                                    "actionType": "submit",
                                    "block": true,
                                    "label": "登陆"
                                }
                            }
                        ]
                    }

                ]
            }
        };

        let amisInstance = amis.embed(
            '#root',
            app, {
            }, {
                theme: 'cxd',
            }
        );

    })();
    </script>
</body>

</html>